<template>
  <div>
    <t-form ref="form"  class="step-form"
            labelWidth="120px" :colon="true">
      <t-row style="flex: 1">
        <t-col :span="12">
          <t-card class="step-card" size="small" title="评价基本信息">
          <t-form-item label="成果名称" name="name">
            {{objData.name}}
          </t-form-item>
          <t-form-item label="成果类别" name="achievementType">
            {{objData.achievementType | filterByDict(dict.type.achievement_type)}}
          </t-form-item>

          <t-form-item label="研发单位" name="createCompany">
            {{objData.createCompany}}
          </t-form-item>
          <t-form-item label="验收时间" name="accepentDate">
            {{objData.accepentDate}}
          </t-form-item>
          <t-form-item label="总经济效益" name="efficiency">
            {{objData.efficiency}}万元
          </t-form-item>
            <t-form-item label="总评价次数" name="count">
              {{objData.count}}
            </t-form-item>
          <t-form-item label="填报单位" name="declareDeptName">
            {{objData.declareDeptName}}
          </t-form-item>
          </t-card>
          <t-card class="step-card" size="small" title="评价列表">
            <evaluate-list ref="evaluate-list" v-model="objData.evaluateLists"></evaluate-list>
          </t-card>
        </t-col>
      </t-row>
    </t-form>
  </div>
</template>

<script>
import { VITE_FILE_DOMAIN } from '@/api/upload'
import evaluateList from "./evaluate-list.vue";

export default {
  name: "evaluate-detail",
  dicts: ['achievement_type'],
  components:{
    evaluateList
  },
  props:{
    objId: [String,Number],
    achievementType: String,
  },
  data() {
    return {
      site_tag: import.meta.env.VITE_SITE_TAG,
      file_domain: VITE_FILE_DOMAIN,
      tabValue: '1',
      objData:{},
    }
  },
  watch: {
    objId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getObj(val);
        }
      }
    },
  },
  methods:{
    getObj(){
      this.$api.cgzh.evaluate.getByAchievementTypeAndId({
        achievementType:this.achievementType,
        achievementId:this.objId,
      }).then(response => {
        this.objData = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    }
  }
}
</script>

<style lang="less" scoped>
.t-tab-panel{
  padding: 10px;
}
.t-form__item{
  margin-bottom:6px
}
.step-card {
  margin-bottom: 14px;
}
</style>
